package com.scqzy.shengchunqiang.sword2offer.day07;

import com.scqzy.shengchunqiang.structure.TreeNode;

import java.util.Objects;

/**
 * @Description: 剑指 Offer 27. 二叉树的镜像
 * @Author 盛春强
 * @Date 2021/8/14 20:41
 */
public class MirrorTree {
    public TreeNode mirrorTree(TreeNode root) {
        if (Objects.isNull(root)) {
            return null;
        }
        TreeNode tmp = root.left;
        root.left = mirrorTree(root.right);
        root.right = mirrorTree(tmp);
        return root;
    }
}
